<?php


namespace App\Http\Requests\Customer\Address;


use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class UpdateRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'customer_id' => ['required', Rule::unique('customer_address', 'customer_id')
                ->where('express_id',  $this->input('express_id'))
                ->ignore($this->route('address'))
            ],
            'express_id' => ['required', 'max:100'],
            'areas' => ['required', 'array', 'size:3'],
            'address' => ['required', 'max:100'],
            'phone' => ['required', 'max:20'],
            'contacts' => ['required', 'max:50'],
            'remark' => ['nullable', 'max:1000']
        ];
    }
}